// $(function(){
	
// 	console.log(comments);

// 	//发布评论
// 	$(':button[class="btn btn-primary"]').click(function(){
// 		 var title=$(':text[name="username"]').val()
// 		 var content= $(':text[name="content"]').val()
// 		 var id=data.id
// 		 $.post('/oper/issue.json',{username:title,content:content,article_id:id},function(res){
//                    if(res.code!=1){
//                    	  alert(res.message)
//                    } 
                                     
// 		 },'json')

// 	})
// })

var obj = {
	xr:function(Adata,comments){
			$('.panel-heading.first').html(Adata.title+":"+Adata.create_time);
			$('.panel-body.first').html(Adata.content);
			if(comments.length>1){
				//有值
				$('.panel-body.first')
				.append('<hr/>')
				// .append($('<div/>',{class:"well"}))
		         
		        $.each(comments,function(key,val){
		        	var well=$('<div/>',{class:"well"}).html(val.content).append($('<h6/>').html(val.username+"发表于"+val.create_time))
		            $('.panel-body.first').append(well)
		        })
		        
			}
	}
}
obj.xr(Adata,comments)
$(':button[class="btn btn-primary"]').click(function(){
	var title=$(':text[name="username"]').val()
	var content= $(':text[name="content"]').val()
	var id=Adata.id
	$.ajax({
		type:"post",
		datatype:"json",
		url:"/oper/issue.json",
		data:{
			username:title,
			content:content,
			article_id:id
		},
		success:function(data){
			console.log(11111)
			if(data.code ==1){
				// console.log(11 111)
				obj.xr(Adata,comments)
				return false;
			}
			
		}
	})
})